<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {include file="/layout/scriptload"}
    <title>编辑屏蔽规则</title>
</head>
<body>
<div class="box">
    <!-- /.box-header -->
    <section class="content">
        <div class="box-body">
            <form role="form">
                <div class="form-group col-md-7">
                    <label>屏蔽规则名称</label>
                    <input type="text" id="rulename" class="form-control"  value="{$data.rulename}">
                </div>
                <div class="form-group col-md-7">
                    <label>屏蔽城市 <span>(用英文 ， 隔开)</span></label>
                    <input type="text" id="city" class="form-control"  value="{$data.city}">
                </div>
                <div class="form-group col-md-7">
                    <label>安全链接</label>
                    <input type="text" id="savelink" class="form-control"  value="{$data.savelink}">
                </div>
                <div class="form-group col-md-7">
                    <label>无效链接</label>
                    <input type="text" id="voidlink" class="form-control"  value="{$data.voidlink}">
                </div>
                <input type="hidden" id="cid" value="{$data.id}">
                <div class="form-group col-md-7" >
                    <div id="btn_save" class="btn pull-right" style="background: #18bc9c;color: #ffffff;">保存</div>
                </div>
            </form>
        </div>
    </section>
</div>
</body>
<script>
    $(function(){
        $('#btn_save').click(function(){
            var _rulename   = $('#rulename').val();
            var _city       = $('#city').val();
            var _savelink   = $('#savelink').val();
            var _voidlink   = $('#voidlink').val();
            var _id   = $('#cid').val();
            if(_rulename == ''){
                layerAlert('屏蔽规则名称不能为空');
                return false;
            }
            if(_city == ''){
                layerAlert('屏蔽城市不能为空');
                return false;
            }
            if(_city == ''){
                layerAlert('安全链接不能为空');
                return false;
            }
            if(_city == ''){
                layerAlert('无效链接不能为空');
                return false;
            }
            $.ajax({
                type:'post',
                cache: false,
                url:"{:url('replyfans/doEditShieldrule')}",
                data:{id:_id,rulename:_rulename,city:_city,savelink:_savelink,voidlink:_voidlink},
                success:function(data){
                    if(data.code==0){
                        layerAlert(data.msg,function(){
                            parent.relist();
                            layerParentClose();
                        });
                    }else{
                        layerAlert(data.msg);
                    }
                }
            })
        })
    })
</script>
</html>